package com.briup.recognition.service.impl;

import com.briup.recognition.bean.BaseLog;
import com.briup.recognition.bean.BaseLogExample;
import com.briup.recognition.dao.BaseLogMapper;
import com.briup.recognition.service.IBaseLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: 黎海梅
 * @Date: 2021/03/28/21:10
 * @Description:
 */
@Service
public class BaseLogServiceImpl implements IBaseLogService {

    @Resource
    private BaseLogMapper baseLogMapper;

    @Override
    public List<BaseLog> query(){
        BaseLogExample example = new BaseLogExample();
        return baseLogMapper.selectByExample(example);

    }

    @Override
    public void saveOrUpdate(BaseLog baseLog){
        if (baseLog.getId()!=null){
            baseLogMapper.updateByPrimaryKey(baseLog);
        }else {
            baseLogMapper.insert(baseLog);
        }
    }

    @Override
    public void deleteById(long id) {
        baseLogMapper.deleteByPrimaryKey(id);
    }

}
